<template>
  <div class="zhubodingdanchaxunlianjie">
    <div
      style="margin-bottom: 20px; font-size: 14px; background: rgb(218, 231, 245); color: rgb(100, 112, 118); padding: 12px 20px;">
      开启后，本店铺所有人员可在订单管理处查看物流轨迹信息，该功能为收费项目，每个订单扣费0.028元，单个订单三十天内多次查询仅扣费一次。</div>
      <div  style="display: flex;align-items: center;">
        <div style="font-size: 14px;color:#364351;margin-right: 15px;">物流轨迹查询</div>
        <el-switch
          @change="changeopen"
          :active-value=1
          :inactive-value=0
          v-model="value"
          active-color="#13ce66"
          inactive-color="#C4C4C4">
        </el-switch>
      </div>
  </div>
</template>

<script>
  import axios from "axios";
  export default {
    name: 'wuliuguijichaxun',
    data() {
      return {
        value:0,
        
      }
    },
    created() {
      //获取当前状态
      this.getstatus()
      
    },
    methods: {
      //获取当前状态
      getstatus(){
        axios.get("/api/plan-market/shop/get/track/status").then(response => {
          if (response.data.msg.code == 0) {
            console.log('获取当前状态')
            console.log(response.data)
            this.value = response.data.data.status
          } else {
            this.$message.error(response.data.msg.info);
          }
        });
      },
      //修改
      changeopen(val){
        console.log(val)
        axios.post("/api/plan-market/shop/track/status",{status:val}).then(response => {
          if (response.data.msg.code == 0) {
            this.$message({
              message: '修改成功',
              type: 'success'
            });
          } else {
            this.$message.error(response.data.msg.info);
          }
        });
      }
    }
  }
</script>

<style lang="scss" scoped>
  .zhubodingdanchaxunlianjie {
    padding: 20px;

    /deep/ .el-button--primary {
        color: #FFF;
        background-color: #2974FF;
        border-color: #2974FF;
    }



    /deep/ #drop .el-button--primary {
      background-color: #2974FF;
      border: 1px #2974FF solid; margin-left: 20px;
      border-radius: 20px;
    }

    // /deep/ .el-button--primary {
    //   background: #EEF7FF;
    //   border: 1px #EEF7FF solid;
    // }

    .flex {
      display: flex;
      align-items: center;
      margin-bottom: 20px;

      .f1 {
        width: 120px;
        text-align: right;
      }
    }


  }
</style>
